package com.lesson01_JavaBase.collection;

import java.util.HashMap;
import java.util.Set;

public class MapTest {
    public static void main(String[] args) {
        HashMap map = new HashMap();
        map.put(1, "a");
        map.put(2, "b");
        map.put(3, "c");
        map.put("3", "3c");

        System.out.println(map.keySet());
        System.out.println(map.values());

        System.out.println(map.get(3));
        System.out.println(map.get("3"));

        Set set = map.keySet();
        for (Object key : set) {
            System.out.println(key+":"+map.get(key));
        }

        System.out.println("================");
        for (Object entry : map.entrySet()) {
            HashMap.Entry entry1 = (HashMap.Entry)entry;
            //System.out.println(entry1);
            System.out.println(entry1.getKey()+":"+entry1.getValue());
        }

    }
}
